/**
 * 所有版权归 广西梧州 陈锦韬 所有
 *
 * @Title: MaxParamInfo
 * @Package com.rx.stock.vo
 * @Description: 参数辅助
 * @author: 陈锦韬
 * @date: 2021/9/14
 * @version V1.0
 * @Copyright: 2021 陈锦韬  All rights reserved.
 */
package com.rx.stock.vo;

import com.rx.core.base.RxBaseData;
import com.rx.core.util.RxUtil;
import lombok.Data;

import java.util.List;

/**
 * @author: CHENJINTAO170
 * @Description: 参数辅助
 * @date: 2021/9/14
 */
@Data
public class MaxParamInfo {

    MaxLocationInfo maxLast = new MaxLocationInfo();

    MaxLocationInfo minLast = new MaxLocationInfo();

    MaxLocationInfo lastMax = new MaxLocationInfo();

    StockShareInfo stockShareInfo;

    List<StockHistoryInfo> stockHistoryInfoList;

    List<RxBaseData> resultList;

    public boolean yesMax(MaxLocationInfo maxLocationInfo){
        return maxLast.getIndex() == maxLocationInfo.getIndex();
    }

    public boolean yesMin(MaxLocationInfo maxLocationInfo){
        return minLast.getIndex() == maxLocationInfo.getIndex();
    }

    public void add(MaxLocationInfo maxLocationInfo){
        if (lastMax.getIndex() > 0 && lastMax.getIndex() == maxLocationInfo.getIndex()){
            // 不能重复插入
            return;
        }
        resultList.add(StockMaxInfo.createByLocation(maxLocationInfo,stockShareInfo.getShareCode()));
        setLastMax(maxLocationInfo);
    }
    public boolean yesSmallerMin(MaxLocationInfo maxLocationInfo){
        return RxUtil.Amount.smaller(maxLocationInfo.getAmount(),minLast.getAmount());
    }
    public void changeMinLast(MaxLocationInfo maxLocationInfo){
        if (yesSmallerMin(maxLocationInfo)){
            setMinLast(maxLocationInfo);
        }
    }

    public boolean yesBiggerMax(MaxLocationInfo maxLocationInfo){
        return RxUtil.Amount.bigger(maxLocationInfo.getAmount(),maxLast.getAmount());
    }
    public void changeMaxLast(MaxLocationInfo maxLocationInfo){
        if (yesBiggerMax(maxLocationInfo)){
            setMaxLast(maxLocationInfo);
        }
    }

}
